import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {NavParams} from 'ionic-angular';
import {ViewController} from 'ionic-angular';
import {Platform} from 'ionic-angular';


//  http请求
import {Http} from '@angular/http';
// import {interfaceUrls} from '../../../provider/serverUrls';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/timeout';
//接受公共服务的产品信息
import {services} from "../../../../../providers/service";
//通过手机号查询到的数据传递到已存在的经销商页面
@Component({
    selector: 'page-product', templateUrl: 'product.html'
})
export class productPage {

    productInner = document.getElementsByClassName("product_contentc")[0];
    protectId = document.getElementById("protectId");
    product = this.services.productList02;

    constructor(public navCtrl: NavController, public http: Http, public platform: Platform, public navParams: NavParams, public viewCtrl: ViewController, public services: services) {
        //接受从服务页面传递过来的产品信息
        console.log(this.product);
    }

//返回产品信息页面
    dismiss() {
        this.viewCtrl.dismiss();
    }

    addToPro(datapr) {
        this.productInner.innerHTML = datapr.name;
        this.services.protectId = datapr.id;
        // this.product.productId
        console.info("产品名称", datapr.name, "产品ID", datapr.id);
        this.viewCtrl.dismiss();

    }

}